import axios from "axios";

const http = axios.create({
    baseURL: "https://apis.netstart.cn/yunyuedu/",
});
http.interceptors.response.use(
    function (response) {
        // 直接获取响应数据中的data
        return response.data;
    },
    function (error) {
        return Promise.reject(error);
    }
);

//get
export const _get = (req) => {
    return http.get(req.url, { params: req.data });
};

//post
export const _post = (req) => {
    return http({
        methods: "post",
        url: `${req.url}`,
        data: req.data,
    });
};
